﻿using Rainbow.ObjectFlow.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rainbow.Exceptions;
using Rainbow.Demo.Objectflow.Client;

namespace coffee.simpleCustomer
{
    class Program
    {
        static void Main(string[] args)
        {
            var commandline = new CommandLine();

            var customerState = Workflow<CustomerState>.Definition()
                .Configure()
                .On<Exception>(() => Console.WriteLine("Caught an exception"))
                .When<CustomerState>()
                .Do<PlaceOrder>()
                .Do<PayForCoffee>()
                .Do<PickUp>()
                .Start(new CustomerState());

            Console.WriteLine(customerState.ToString());
            Console.WriteLine("\r\nPress any key");

            commandline.WaitForKeyPress();
        }
    }

    public class CommandLine
    {
        public void WaitForKeyPress()
        {
            Console.ReadKey();
        }
    }
}
